package com.tech.java;

import org.junit.Test;

import java.util.*;

/**
 * @Description:
 * @Author: zl
 * @Date: 2019/7/10 9:37
 */
public class ListDemo {

    @Test
    public void arrayList() {
        //0. 底层采用数组的方式存储
        //1. arraylist 提供3种不同的方式进行函数构造
        ArrayList<String> list = new ArrayList(0);
        //2.arraylist 1.5倍扩容
        list.add("a");
        System.out.println(10 >> 1);
    }

    @Test
    public void vertor() {
        //线程安全的 -- 初始空间大小为10的数组 ， 默认1倍扩容
        Vector vector = new Vector();
        for (int i = 0; i <= 11; i++) {
            vector.add("a" + i);
        }

    }

    @Test
    public void linkedList() {
        LinkedList<String> linkedList = new LinkedList<>();
        linkedList.add("a");
        linkedList.get(0);

    }

    public static void main(String[] args) {
        Stack<String> stack  = new Stack();
        stack.push("a");
        stack.push("b");
        stack.push("c");
        System.out.println(stack.pop());
        Iterator iterator = stack.iterator();
        while (iterator.hasNext()) {
            //String s = (String) iterator.next();
            System.out.println(stack.pop());
        }

        //List<String> lis = new ArrayList<String>();
        /*for (int i = 0; i < 20; i++) {
            System.out.println(i % 10);
        }*/

    }
}
